package com.rc.saas.tenant.service.member;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.mapper.member.MemberCardRecordMapper;
import com.rc.saas.tenant.search.member.MemberCardRecordSearch;
import com.rc.saas.tenant.vo.member.MemberCardRecordResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by sven on 2019/11/20
 */
@Service
public class MemberCardRecordServiceImpl implements MemberCardRecordService {
    @Autowired
    private MemberCardRecordMapper memberCardRecordMapper;

    @Override
    public MemberCardRecordMapper getMapper() {
        return memberCardRecordMapper;
    }


    @Override
    public PageInfo<MemberCardRecordResult> searchByCondition(MemberCardRecordSearch memberCardRecordSearch) {
        PageHelper.startPage(memberCardRecordSearch.getOffset(), memberCardRecordSearch.getLimit());
        List<MemberCardRecordResult> memberCardRecordResults = memberCardRecordMapper.searchByCondition(memberCardRecordSearch);
        return new PageInfo<MemberCardRecordResult>(memberCardRecordResults);
    }
}
